<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>上传下载首页</title>
    </head>
    <body>
        <input type="file" name="file" id="file" value="" placeholder="免冠照片">
        <input type="button" onclick="postData();" value="下一步" name="" style="width:100px;height:30px;">
    </body>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script>
        function postData() {
            var formData = new FormData();
            formData.append("file", $("#file")[0].files[0]);
            formData.append("service", 'App.Passion.UploadFile');
            $.ajax({
                url: '/upload', /*接口域名地址*/
                type: 'post',
                data: formData,
                contentType: false,
                processData: false,
                success: function (res) {
                    console.log(res.data);
                    if (res.data["code"] === "succ") {
                        alert('成功');
                    } else if (res.data["code"] === "err") {
                        alert('失败');
                    } else {
                        console.log(res);
                    }
                }
            })
        }
    </script>
</html>